<?php


declare (strict_types=1);

namespace app\mall\model;

use app\mall\model\MallGoods;
use app\mall\model\MallOrder;
use think\admin\Model;
use think\model\relation\HasOne;

/**
 * 商城订单详情模型
 * @class PluginWemallOrderItem
 * @package plugin\wemall\model
 */
class MallOrderItem extends Model
{

    /**
     * 关联订单信息
     * @return \think\model\relation\HasOne
     */
    public function main(): HasOne
    {
        return $this->hasOne(MallOrder::class, 'order_no', 'order_no');
    }

    /**
     * 关联商品信息
     * @return \think\model\relation\HasOne
     */
    public function goods(): HasOne
    {
        return $this->hasOne(MallGoods::class, 'code', 'gcode');
    }
}